import { useNavigate } from 'react-router-dom';
import { IRouter } from './index';

const RouterAuth = (routers: IRouter[]) => {
  const navigate = useNavigate();
  const token = JSON.parse(localStorage.getItem('token') || '');
  console.log(token, 3333);
  if (!token) {
    navigate('/login', { replace: true });
  } else {
    return routers;
  }
};
export default RouterAuth([]);
